<template>
  <div class="circle-all">
    <div class="ballAndCircleLeft ballAndCircleLeftActive">
      <div class="outLeft outLeftActive" :style="outLeft">
        <div class="ballAll ballEight" :style="`background: ${globalStore.primary}`">
          <div class="ballEightText">归档环节</div>
        </div>
        <div class="ballAll ballNine" :style="`background: ${globalStore.primary}`">
          <div class="ballNineText">真实性检测</div>
        </div>
      </div>
      <div class="ballAll ballOne" :style="`background: ${globalStore.primary}`">
        <div class="ballOneText">可用性检测</div>
      </div>
      <div class="ballAll ballTwo" :style="`background: ${globalStore.primary}`">
        <div class="ballTwoText">完整性</div>
      </div>
      <div class="ballAll ballThree" :style="`background: ${globalStore.primary}`">
        <div class="ballThreeText">长期保存环节</div>
      </div>
      <div class="circleLeft" :style="outLeft"></div>
    </div>

    <div class="circleBox">
      <div class="circle" :style="`background: ${gradientStyle}`">
        <div class="scanning">
          <div>{{ allFinish ? "已完成" : "扫描中..." }}</div>
          <div class="percentages">{{ props.percentage }}%</div>
        </div>
      </div>
      <div class="circleOne" :style="`background: ${lighterColor}`">
        <div class="circleTwo" :style="`border-color: ${globalStore.primary}`"></div>
        <div class="circleThree" :style="`border-color: ${globalStore.primary}`"></div>
        <div class="circleFour" :style="`border-color: ${globalStore.primary}`"></div>
      </div>
    </div>
    <div class="ballAndCircleRight ballAndCircleRightActive">
      <div class="outRight outRightActive" :style="outRight"></div>
      <div class="ballAll ballFour" :style="`background: ${globalStore.primary}`">
        <div class="ballFourText">移交与接收环节</div>
      </div>
      <div class="ballAll ballFive" :style="`background: ${globalStore.primary}`">
        <div class="ballFiveText">完整性检测</div>
      </div>
      <div class="ballAll ballSix" :style="`background: ${globalStore.primary}`">
        <div class="ballSixText">安全性检测</div>
      </div>
      <div class="ballAll ballSeven" :style="`background: ${globalStore.primary}`">
        <div class="ballSevenText">准确性</div>
      </div>
      <div class="circleRight" :style="outRight"></div>
    </div>
  </div>
</template>
<script lang="ts" setup>
import { useGlobalStore } from "@/stores/modules/global";
import { lightenColor, circleThemeColor } from "./fourAspect";
import { ref, computed } from "vue";
const globalStore = useGlobalStore();
const props = defineProps({
  // 扫描进度
  percentage: {
    type: Number,
    default: 0
  },
  allFinish: {
    type: Boolean,
    default: false
  }
});

const gradientStyle = ref<string>(""); // 渐变色
const lighterColor = ref<string>(""); // 靠近主题色，但是又比主题色淡一点

// 计算渐变样式
gradientStyle.value = circleThemeColor(globalStore.primary);

// 计算稍微淡一点的颜色
// lighterColor.value = getLighterColor(globalStore.primary);
lighterColor.value = lightenColor(globalStore.primary, 0.2);

// 最左侧波纹
const outLeft = computed(() => {
  return {
    borderLeft: `1px solid ${globalStore.primary}`,
    background: `linear-gradient(90deg, ${lighterColor.value}, rgba(255, 255, 255, 0.01), rgba(255, 255, 255, 0.01))`
  };
});

// 最右侧波纹
const outRight = computed(() => {
  return {
    borderRight: `1px solid ${globalStore.primary}`,
    background: `linear-gradient(90deg, rgba(255, 255, 255, 0.01), rgba(255, 255, 255, 0.01), ${lighterColor.value})`
  };
});

console.log("渐变计算---", gradientStyle); // 打印渐变样式
</script>
<style lang="scss" scoped>
.circleBox {
  position: relative;
  width: 190px;
  height: 190px;
}
.circle {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 99;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 140px;
  height: 140px;
  color: #ffffff;
  cursor: pointer;
  background: linear-gradient(90deg, #80cbc4, #009688, #00796b);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.circleOne {
  position: absolute;
  z-index: 88;
  width: 190px;
  height: 190px;
  background: #80cbc4;
  border-radius: 50%;
  animation-name: circle-change1;
  animation-delay: 1s;
}
.circleTwo {
  position: absolute;
  z-index: 77;
  border: 1px solid #00796b;
  border-radius: 50%;
  animation-name: circle-change2;
  animation-delay: 2s;
}
.circleThree {
  position: absolute;
  z-index: 66;
  border: 1px solid #009688;
  border-radius: 50%;
  animation-name: circle-change3;
  animation-delay: 3s;
}
.circleFour {
  position: absolute;
  top: -2px;
  left: -1px;
  z-index: 55;
  border: 2px dotted #80cbc4;
  border-radius: 50%;
  animation-name: circle-change4;
  animation-delay: 4s;
}
.circleTwo,
.circleThree,
.circleFour {
  width: 190px;
  height: 190px;
  animation-duration: 3s;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
@keyframes circle-change1 {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  25% {
    opacity: 0.75;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1);
  }
  75% {
    opacity: 0.25;
    transform: scale(1);
  }
  100% {
    opacity: 0.75;
    transform: scale(1);
  }
}
@keyframes circle-change2 {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  25% {
    opacity: 0.75;
    transform: scale(1.2);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.4);
  }
  75% {
    opacity: 0.25;
    transform: scale(1.6);
  }
  100% {
    opacity: 0.05;
    transform: scale(1.8);
  }
}
@keyframes circle-change3 {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  25% {
    opacity: 0.75;
    transform: scale(1.2);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.4);
  }
  75% {
    opacity: 0.25;
    transform: scale(1.6);
  }
  100% {
    opacity: 0.05;
    transform: scale(1.8);
  }
}
@keyframes circle-change4 {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  25% {
    opacity: 0.75;
    transform: scale(1.2);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.4);
  }
  75% {
    opacity: 0.25;
    transform: scale(1.6);
  }
  100% {
    opacity: 0.05;
    transform: scale(1.8);
  }
}
.circleLeft {
  position: relative;
  left: 60px;
  width: 250px;
  height: 259px;
  background: linear-gradient(90deg, #80cbc4, rgb(255 255 255 / 1%), rgb(255 255 255 / 1%));
  border-left: 1px solid #00796b;
  border-radius: 50%;
}
.circleRight {
  position: relative;
  right: 125px;
  width: 250px;
  height: 259px;
  background: linear-gradient(90deg, rgb(255 255 255 / 1%), rgb(255 255 255 / 1%), #80cbc4);
  border-right: 1px solid #00796b;
  border-radius: 50%;
}
.circle-all {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 600px;

  // height: 400px;
  margin: -150px 0 0;
  transform: scale(0.8);
}
.ballAll {
  z-index: 6;
  width: 10px;
  height: 10px;
  color: #ffffff;
  text-align: center;
  background-color: #009688;
  border-radius: 50%;
}
.ballOne {
  position: absolute;
  top: 58px;
  left: 73px;
}
.ballTwo {
  position: absolute;
  top: 122px;
  left: 56px;
}
.ballThree {
  position: absolute;
  top: 195px;
  left: 75px;
}
.ballAndCircleLeft {
  position: relative;
  z-index: 9;
  width: 200px;
}
.ballAndCircleLeftActive {
  animation-name: left-animation;
  animation-duration: 3s;
  animation-timing-function: linear;
  animation-delay: 3s;
  animation-iteration-count: infinite;
}
.ballAndCircleRight {
  position: relative;
  z-index: 9;
  width: 200px;
}
.ballAndCircleRightActive {
  animation-name: right-animation;
  animation-duration: 3s;
  animation-timing-function: linear;
  animation-delay: 3s;
  animation-iteration-count: infinite;
}
.ballFour {
  position: absolute;
  top: 14px;
  right: 128px;
}
.ballFive {
  position: absolute;
  top: 71px;
  right: 81px;
}
.ballSix {
  position: absolute;
  top: 140px;
  right: 71px;
}
.ballSeven {
  position: absolute;
  top: 222px;
  right: 111px;
}
.ballEight {
  position: absolute;
  top: 31px;
  left: 30px;
}
.ballNine {
  position: absolute;
  top: 172px;
  left: 3px;
}
@keyframes left-animation {
  0% {
    left: 20px;
    opacity: 0.05;
  }
  50% {
    left: 0;
    opacity: 1;
  }
  100% {
    left: -20px;
    opacity: 0.05;
  }
}
@keyframes right-animation {
  0% {
    right: 20px;
    opacity: 0.05;
  }
  50% {
    right: 0;
    opacity: 1;
  }
  100% {
    right: -20px;
    opacity: 0.05;
  }
}
.outLeft {
  position: absolute;
  left: -5px;
  z-index: 5;
  width: 250px;
  height: 259px;
  background: linear-gradient(90deg, #80cbc4, rgb(255 255 255 / 1%), rgb(255 255 255 / 1%));
  border-left: 1px solid #00796b;
  border-radius: 50%;
}
.outLeftActive {
  animation-name: out-left-animation;
  animation-duration: 3s;
  animation-timing-function: linear;
  animation-delay: 3s;
  animation-iteration-count: infinite;
}
.outRight {
  position: absolute;
  right: 14px;
  z-index: 5;
  width: 250px;
  height: 259px;
  background: linear-gradient(90deg, rgb(255 255 255 / 1%), rgb(255 255 255 / 1%), #80cbc4);
  border-right: 1px solid #00796b;
  border-radius: 50%;
}
.outRightActive {
  animation-name: out-right-animation;
  animation-duration: 3s;
  animation-timing-function: linear;
  animation-delay: 3s;
  animation-iteration-count: infinite;
}
@keyframes out-left-animation {
  0% {
    left: 30px;
    opacity: 0.05;
  }
  50% {
    left: -5px;
    opacity: 1;
  }
  100% {
    left: -30px;
    opacity: 0.05;
  }
}
@keyframes out-right-animation {
  0% {
    right: 40px;
    opacity: 0.05;
  }
  50% {
    right: 20px;
    opacity: 1;
  }
  100% {
    right: -30px;
    opacity: 0.05;
  }
}
.check-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100px;
  height: 100px;
  font-size: 20px;
  color: #ff8040;
  background-color: #ffffff !important;
  border: 1px solid #ffc49a;
  border-radius: 50%;
}
.check-outer {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 120px;
  margin-top: -10px;
  margin-left: -25px;
  border: 1px dashed #e0e0e0;
  border-radius: 50%;
}
.check-text-account {
  position: absolute;
  top: -52px;
  color: #999999;
}
.check-text-risk {
  position: absolute;
  top: -13px;
  left: 17px;
  color: #999999;
}
.check-text-analysis {
  position: absolute;
  top: 25px;
  color: #999999;
}
.ballOneText {
  width: 70px;
  margin-top: 10px;
  margin-left: -28px;
}
.ballTwoText {
  width: 130px;
  margin-top: 10px;
  margin-left: -52px;
}
.ballThreeText {
  width: 70px;
  margin-top: 10px;
  margin-left: -28px;
}
.ballFourText {
  width: 72px;
  margin-top: 10px;
  margin-left: -20px;
}
.ballFiveText {
  width: 113px;
  margin-top: 10px;
  margin-left: -53px;
}
.ballSixText {
  width: 70px;
  margin-top: 10px;
  margin-left: -23px;
}
.ballSevenText {
  width: 120px;
  margin-top: 10px;
  margin-left: -38px;
}
.ballEightText {
  width: 70px;
  margin-top: 10px;
  margin-left: -23px;
}
.ballNineText {
  width: 110px;
  margin-top: 10px;
  margin-left: -23px;
}
.scanning-mask {
  position: absolute;
  top: 1px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: calc(100vh - 160px);
  margin-top: 30px;
  background: rgb(255 255 255 / 90%);
}
.settleAccountsClassNameScan {
  width: 100px;
  height: 100px;
  border: 0;
  border-radius: 50px;
}
.unSettleAccountsClassNameScan {
  width: 100px;
  height: 100px;
  border: 0;
  border-radius: 50px;
}
.scanning {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  .percentages {
    margin-top: 12px;
  }
}
</style>
